package com.example.demo.service;

import com.example.demo.crawler.Crawler;
import com.example.demo.domain.ContentDO;
import com.example.demo.processor.Processor;
import com.example.demo.util.StringUtil;

public abstract class AbstractDingdianService {
    private Crawler crawler;
    private Processor processor;
    public ContentDO getContentDO(String url){
        String extract = crawler.extract(url);
        if(StringUtil.isEmpty(extract)){
            return null;
        }
        ContentDO process = processor.process(extract);
        return process;
    }

    public void setCrawler(Crawler crawler) {
        this.crawler = crawler;
    }

    public void setProcessor(Processor processor) {
        this.processor = processor;
    }
}
